package shopping.bag.littlebag;

import shopping.bag.Zh0202LittleBag;
import shopping.component.Zh0202Shopping;

import java.util.ArrayList;

/**
 * @author: zh
 * @date: 2021/12/3 11:40
 * @version: 1.0
 */
public class Zh0202LittleRedBag extends Zh0202LittleBag {
    private double price = 0;

    private String bagType = "红色小袋子";

    private ArrayList<Zh0202Shopping> list = new ArrayList<Zh0202Shopping>();

    @Override
    public void add(Zh0202Shopping shopping){
        list.add(shopping);
    }

    @Override
    public void remove(Zh0202Shopping shopping){
        list.remove(shopping);
    }

    @Override
    public double buy() {
        System.out.println("用"+bagType+"装了");
        for (Zh0202Shopping shopping : list) {
            price += shopping.buy();
        }
        return price;
    }
}
